Completed
Push — master ( 67e4d1...18ce39 )
by
unknown
02:06
created

get-update.js ➔ ... ➔ p.catch   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
c 0
b 0
f 0
nc 1
nop 1
dl 0
loc 3
rs 10
1
import {
2
  abeDuplicate,
3
  Hooks
4
} from '../../cli'
5
6
var route = function(req, res, next) {
7
  Hooks.instance.trigger('beforeRoute', req, res, next)
8
9
  var p = abeDuplicate(req.query.oldFilePath, req.query.selectTemplate, req.query.filePath, req.query.tplName, req, true)
10
11
  p.then((resSave) => {
12
    var result = {
13
      success: 1,
14
      json: resSave
15
    }
16
    res.set('Content-Type', 'application/json')
17
    res.send(JSON.stringify(result))
18
  },
19
  () => {
20
    var result = {
21
      success: 0
22
    }
23
    res.set('Content-Type', 'application/json')
24
    res.send(JSON.stringify(result))
25
  }).catch(function(e) {
26
    console.error(e)
27
  })
28
}
29
30
export default route